﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ERP.Classes;

namespace ERP
{
    public partial class viewLogin : Form
    {
        public viewLogin()
        {
            InitializeComponent();
        }

        private void viewLogin_Load(object sender, EventArgs e)
        {

        }

        private void btnLogin_Click(object sender, EventArgs e)
        {
            user.username = this.txtUser.Text;
            user.pass = this.txtPass.Text;
            if (user.Get_Info() > 0)
            {
                if (user.pass == this.txtPass.Text.Trim())
                {
                    this.Close();
                }
            }
        }

        private void txtPass_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 13)
            {
                this.btnLogin_Click(sender, e);
            }
        }

        private void txtUser_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 13)
            {
                this.txtPass.Focus();
            }
        }

        private void simpleButton_Thoat_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            frmSettings vSetting = new frmSettings();
            vSetting.ShowDialog();
        }

        
    }
}
